<%@page contentType="text/html; charset=UTF-8"%>
<%@taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@include file="/common/definition.jsp"%>

<html:html>
<tiles:insert beanName="admin-definition" flush="true">
	<tiles:put name="title"> Administrator Management </tiles:put>
	<tiles:put name="body" type="string">
		<s:form theme="simple">
			<div class="col-md-4">
				<p class="muted">Thương Hiệu</p>
				<ul
					style="width: 200px; height: 200px; overflow: auto; border: 1px solid #90bade;">
					<s:if test="productModel.listBrandInfo != null">
						<s:iterator value="productModel.listBrandInfo" id="list">
							<li><s:a action="getBrandInfo">
									<s:property value="brandName" />
									<s:param name="id" value="brandID" />
								</s:a></li>
							<%-- <a href="deleteBrand.action?id=${brandID}">Deleted</a></li> --%>
						</s:iterator>
					</s:if>
					<s:if test="listBrandInfo != null">
						<s:iterator value="listBrandInfo" id="list">
							<li><s:a action="getBrandInfo">
									<s:property value="brandName" />
									<s:param name="id" value="brandID" />
								</s:a></li>
							<%-- <a href="deleteBrand.action?id=${brandID}">Deleted</a></li> --%>
						</s:iterator>
					</s:if>
				</ul>
			</div>
		</s:form>
		<s:form id="add-brand" theme="simple" cssClass="form">
			<div class="col-md-5">
				<h1>Add Brand</h1>
				<s:property value="errorAddBrand" />
				<div class="form-group">
					<label>Brand Name</label> <input type="text"
						name="brandInfo.brandName" class="form-control" />
					<%-- <s:textfield name="brandInfo.brandName"
										cssClass="contact_input" /> --%>
				</div>
				<br />
				<div class="form-group">
					<label>Website</label> <input type="text" name="brandInfo.website"
						class="form-control" />
					<%-- <s:textfield name="brandInfo.website" cssClass="contact_input" /> --%>
				</div>
				<br />
				<div>
					<button onclick="switchAction('add-brand', 'addBrand')"
						class="btn btn-primary">Add</button>
					<button type="reset" class="btn btn-default">Clear</button>
				</div>
			</div>
		</s:form>

	</tiles:put>
</tiles:insert>
</html:html>

<script type="text/javascript">
	function switchAction(formId, action) {
		$('#' + formId).attr('action', action);
		$.post(action);
	}
</script>
